package netty.v3.serializer;

import java.util.Arrays;
import java.util.Optional;

public enum  Command {

    LOGIN_COMMAND(1, "登录"),

    ;

    int type;

    String desc;

    Command(int type, String desc) {
        this.type = type;
        this.desc =  desc;
    }

    public int getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static Command get(int type){
        return Arrays.stream(Command.values()).filter(c -> c.type == type).findFirst().orElse(null);
    }
}
